
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navLists: [
      {
        name: "待发货"
      },
      {
        name: "待收货"
      },
      {
        name: "已完成"
      },
    ],
    current: 0,
    radioItems: [
      { name: '1', value: '满意', checked: 'true' },
      { name: '2', value: '不满意',  },
    ],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    this.setData({
      userInfo: wx.getStorageSync("userInfo"),
      imageUrl: app.globalData.imageUrl
    })
    wx.getSystemInfo({//获取滑块的高宽
      success: function (res) {
        that.setData({
          winWidth: res.windowWidth,
          winHeight: res.windowHeight
        });
      }
    });
    //    getOrderForm(that,1);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  getOrderList: function (e) {
    that.setData({
      current: e.target.id
    })
    if (e.target.id == 0) {
      // getOrderForm(that, 1);
    } else if (e.target.id == 1) {
      // getOrderForm(that, 2);
    } else if (e.target.id == 2) {
      // getOrderForm(that, 6);
    }
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
  , cancelOrder: function (e) {//取消订单

  }
  , sureReceiving: function (e) {//确认收货
    wx.request({
      url: app.globalData.allUrl + "/productaAction/receiving",
      data: {
        orderFormId: e.target.id
      },
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      // header: {}, // 设置请求的 header
      success: function (res) {
        console.log(res.data);
      }
    })
  }
  , logistics: function (e) {//物流

  },
  getOrderList: function (e) {
    this.setData({
      current: e.target.id
    })
  }
})


function getOrderForm(that, _id) {
  wx.request({
    url: app.globalData.allUrl + "/orderFormAction/getOrderFormByStatus",
    data: {
      userid: wx.getStorageSync('userid'),//用户唯一ID
      status: _id //订单状态ID（1-5）
    },
    method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
    // header: {}, // 设置请求的 header
    success: function (res) {
      console.log(res.data);
      that.setData({
        allOrderForm: res.data,
      })
    }
  })
}